package cn.ggy;

import cn.ggy.dao.StuDao;
import cn.ggy.polo.User;
import cn.ggy.service.StuService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Mytest {

    @Test
    public void t1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        StuDao stuDao = context.getBean("stuDaoImpl", StuDao.class);
        stuDao.getStu();
    }

    @Test
    public void t2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        StuService stuServiceImpl = context.getBean("stuService2", StuService.class);
        stuServiceImpl.getStu();
    }

    @Test
    public void t3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = context.getBean("user", User.class);
//        user.show();
        System.out.println(user.getName());
    }
}


